package com.wisezone.workflow.web;

import java.util.List;

import com.wisezone.common.exception.WzWebException;
import com.wisezone.common.web.BaseFormController;
import com.wisezone.workflow.bean.WfDataDictionary;
import com.wisezone.workflow.bean.search.WfDataDictionarySearch;
import com.wisezone.workflow.core.FlowEngine;

/**
 * 工作流控制类 2010-08-24
 * @author shan
 *
 * @param <T> 持久实体
 * @param <S> 查询实体
 * @param <F> 表单实体
 */
public class WfWorkFlowController<T,S,F> extends BaseFormController<T, S, F> {

	protected FlowEngine flowEngine;

	/**
	 * 获得流程数据字典状态列表
	 * @param parentId
	 * @return
	 * @throws WzWebException
	 */
	protected List<WfDataDictionary> getDataDictList(Long parentId) throws WzWebException{
		return  this.flowEngine.getWfDataDictionaryDao().listByParentId(parentId);	
	}
	
	/**
	 *  获得流程数据字典状态列表
	 * @param searchEntity
	 * @return
	 * @throws WzWebException
	 */
	protected List<WfDataDictionary> getDataDictList(WfDataDictionarySearch searchEntity) throws WzWebException{
		return  this.flowEngine.getWfDataDictionaryDao().listAll(searchEntity);	
	}
	
	/**
	 * 获得流程数据字典ID
	 * @param category 类别
	 * @param code 编码
	 * @return
	 * @throws WzWebException
	 */
	protected Long getStateId(String category,String code) throws WzWebException{
		
		return this.flowEngine.getWfDataDictionaryDao().getDataDictionaryId(category, code);
	}
	
	
	public void setFlowEngine(FlowEngine flowEngine) {
		this.flowEngine = flowEngine;
	}
	
	
}
